
include ../Makefile.Res
Version:=2.8.0.2
ModuleName:=snort

Object:=snort.tgz
ObjectDir:=$(ModuleName)-$(Version)
ObjectSource:=$(ModuleName)-$(Version).tar.gz

DependFiles:=

ExtModuleNames:=

InstallDir:=/usr/local/snort
InstLogDir:=var/log/snort

Config:=--prefix=$(InstallDir) --sysconfdir=/usr/local/snort/etc/ \
	--enable-rulestate  --enable-dynamicplugin --enable-linux-smp-stats\
	--enable-perfprofiling --with-snmp

Depend:=snortrules-snapshot-CURRENT.tar.gz Community-Rules-CURRENT.tar.gz \
	classification.config reference.config snort.conf

.PHONY: all clean dist_clean

null:

all:$(Object) 

$(Object):$(ObjectSource) $(Depend)
	rm -rf var usr
	tar -xzf $(ObjectSource)
	cd $(ObjectDir);./configure $(Config)
	$(MAKE) -C $(ObjectDir)
	$(MAKE) -C $(ObjectDir) check
	$(MAKE) -C $(ObjectDir) install DESTDIR=`pwd`/
	rm -rf usr/local/snort/share
	mkdir -p $(InstLogDir) usr/local/snort/etc usr/local/snort/rules
	cp -rf classification.config reference.config snort.conf usr/local/snort/etc/
	cp -rf $(ObjectDir)/etc/*.map usr/local/snort/etc/
	tar -xzf snortrules-snapshot-CURRENT.tar.gz
	#tar -xzf Community-Rules-CURRENT.tar.gz
	mv rules usr/local/snort/ && mv usr/local/snort/lib usr/local/
	tar -czf $(Object) usr $(InstLogDir)

test:$(Object)
	scp $(Object) $(TestServer):/packages
	ssh $(TestServer) tar xzvf /packages/$(Object)

clean:
	rm -rf $(Object) usr doc docs so_rules var

dist_clean:clean
	rm -rf $(ObjectDir) $(ObjectSource) *.tar.gz
	
